<template>
    <div class="profile">
      <div class="card">
        <img src="@/assets/bac/Login-bac.jpg" class="background-image" />
        <div class="content">
          <el-menu
            :default-active="activeTab"
            class="menu"
            background-color="#f5f5f5"
            text-color="#333"
          >
            <el-menu-item
              index="profile"
              @click="activeTab = 'profile'"
              :class="{ active: activeTab === 'profile' }"
            >
              个人资料
            </el-menu-item>
            <el-menu-item
              index="password"
              @click="activeTab = 'password'"
              :class="{ active: activeTab === 'password' }"
            >
              密码安全
            </el-menu-item>
          </el-menu>
          <div class="main-content">
            <component :is="currentComponent" />
          </div>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  import ProfileInfo from '@/components/Profile/ProfileInfo.vue'
  import PasswordSecurity from '@/components/Profile/PasswordSecurity.vue'
  
  export default {
    data() {
      return {
        activeTab: 'profile',
      }
    },
    computed: {
      currentComponent() {
        return this.activeTab === 'profile' ? ProfileInfo : PasswordSecurity
      }
    }
  }
  </script>
  
  <style scoped>
  .profile {
    width: 70%;
    height: 150%;
    margin: 0 auto; /* Center the profile component */
    display: flex;
    flex-direction: column;
    margin-top: 20px; /* Add top margin for spacing */

  }
  
  .card {
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    flex: 1; /* Allow card to take full height */
    min-height: 100%; /* Ensure card takes minimum height of 100% of parent */
  }
  
  .background-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
  }
  
  .content {
    display: flex;
    height: calc(100% - 200px); /* full height minus the background image */
  }
  
  .menu {
    width: 150px; /* Set desired width for menu */
  }
  
  .main-content {
    flex: 1; /* Main content takes the remaining space */
    padding: 20px; /* Inner padding for main content */
    border: none; /* No border for main content */
  }
  
  /* Styling active menu item */
  .menu .el-menu-item.active {
    background-color: #e0e0e0; /* Change background color for active menu item */
    color: #409eff; /* Change text color for active item */
  }
  </style>
  